import Vue from "vue";

import App from "./App.vue";

import VueRouter from "vue-router";
Vue.use(VueRouter);

import LayoutIndex from "./views/layout/LayoutIndex.vue";
import HomeIndex from "./views/home/HomeIndex.vue";
import UsersIndex from "./views/users/UsersIndex.vue";

const router = new VueRouter({
  routes: [
    {
      path: "/home",
      name: "Home",
      // redirect: { name: "HomeIndex" },
      component: LayoutIndex,
      meta: {
        name: "首页",
      },
      children: [
        {
          path: "index",
          name: "HomeIndex",
          component: HomeIndex,
          meta: {
            name: "首页",
          },
        },
      ],
    },
    {
      path: "/users",
      name: "Users",
      component: LayoutIndex,
      redirect: { name: "UsersIndex" },
      meta: {
        name: "用户管理",
      },
      children: [
        {
          path: "index",
          name: "UsersIndex",
          component: UsersIndex,
          meta: {
            name: "用户管理",
          },
        },
      ],
    },

    {
      path: "/shops",
      name: "Shops",
      redirect: { name: "ShopsIndex" },
      component: LayoutIndex,
      meta: {
        name: "商城",
      },
      children: [
        {
          path: "index",
          name: "ShopsIndex",
          component: () => import("./views/shops/ShopsIndex.vue"),
          meta: {
            name: "商城首页",
          },
        },
        {
          path: "list",
          name: "ShopsList",
          component: () => import("./views/shops/ShopsList.vue"),
          meta: {
            name: "商城列表",
          },
        },
        {
          path: "add",
          name: "ShopsAdd",
          component: () => import("./views/shops/ShopsAdd.vue"),
          meta: {
            name: "商城添加",
          },
        },
      ],
    },
  ],
});

new Vue({
  render: (h) => h(App),
  router,
}).$mount("#app");
